public class ClientClass {
    public static void main(String[] args) {
        Factory factory = new Factory();

        // 创建红色苹果
        Fruit redApple = factory.CreateFruit("A", new Red());
        redApple.eat(); // 输出：吃红色苹果

        // 创建黄色香蕉
        Fruit yellowBanana = factory.CreateFruit("B", new Yellow());
        yellowBanana.eat(); // 输出：吃黄色香蕉

        // 扩展新颜色无需修改工厂
        Fruit blueApple = factory.CreateFruit("A", new Color(){
            public String applyColor() { return "蓝色"; }
        });
        blueApple.eat(); // 输出：吃蓝色苹果
    }
}